
public class CodeBreakerGame {

	public static String ALPHABET ;  // These are the letters from which the code is generated.
	public static Integer CODE_LENGTH  ;       // Number of characters in the code and guesses 
	public static Integer MAX_ATTEMPTS      ; // Number of guesses you have before you lose 
	public static String QUIT_SEQUENCE;  // What to input to quit the game

	public CodeBreakerGame(){
		ALPHABET = "ABCDEF";   // These are the letters from which the code is generated.
		CODE_LENGTH = 3;        // Number of characters in the code and guesses 
		MAX_ATTEMPTS = 10;     // Number of guesses you have before you lose 
		QUIT_SEQUENCE = "ZZZ"; // What to input to quit the game
	}

	public static void main(String args[])
	{
		if (args[0].contains("D"))
		{
			//ENTER DEBUG MODE
			System.out.println("THIS IS DEBUG MODE");
		}
		else {
			//ENTER STANDARD MODE
		}
			
	
	}
	public static String codeGenerator(String alphabet, int codelength){
		//A local character array 'c' that stores the letters in 'alphabet'
		//such that they can be randomly permuted before being cropped.

		char[] c = alphabet.toCharArray();

		//'rand' is a random number generator instance of class 'Random'
		//A method of this class has the signature: int nextInt(int n)
		//and returns a pseudorandom, uniformly distributed int value
		//between 0 (inclusive) and the integer 'n' (exclusive).

		java.util.Random rand = new java.util.Random();

		//The following code creates a randomly permuted character array
		//of the letters in 'alphabet'. Intuitively, imagine you have
		//six index cards with the letters from 'alphabet' written on
		//each. You have a friend pick them at random from your hand
		//and place them one by one on the table from right to left.
		//In other words, the first card picked becomes the last letter
		//in the permuted array and the second card is the second to
		//last, the third is the third to last, and so on...

		int last = alphabet.length()-1;

		while(last>0){

			//'rand' picks a random card from your hand
			//where your hand consists of letters from
			//character 0 to character 'last' in the array.

			int next = rand.nextInt(last);

			//Swap the letter at 'next' with the letter at 'last'
			//Like putting the randomly chosen card on the table
			//to the left of the other cards on the table.

			char temp = c[last];
			c[last] = c[next];
			c[next] = temp;

			//'last' decrements so that you only select cards
			//from the remaining set.

			last--;
		}

		//Now that 'c' is a randomly permuted array of the letters
		//in 'permuted_letterset', select just the first 'codelength'
		//to be in the returned 'code'.

		String permuted_letterset = new String(c);
		String code = permuted_letterset.substring(0,codelength);
		return code;
	}
}